package com.smrtcold.dev.task;

import com.smrtcold.dev.mapper.DataMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/* @ClassName: SysTask
 * @Description:
 * @Date: 2019/10/14：17:39
 * @Author: Maqiang34
 * @Version: V1.0.0
 */
@Component
@RequiredArgsConstructor
public class SysTask {

    private final DataMapper dataMapper;

    /**
     * 清理数据
     */
    @Scheduled(cron = "0 30 0 * * ?")
    public synchronized void task() {
        try {
            dataMapper.clearData();
            dataMapper.clearLogs();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }



}

